package com.jt.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jt.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

//mp提供了强大的单表CRUD操作，多表操作自己写 必须加泛型
public interface UserMapper extends BaseMapper<User> {

    List<User> findAll();


    User findUserByUP(User user);

    @Select("select count(1) from user")
    long findTotal();
    //只支持单值传参 封装为map集合
    List<User> findUserList(@Param("start") int start,@Param("size") int size,@Param("query") String query);

    @Update("update user set status = #{status} , updated = #{updated} where id = #{id}")
    void updateStatus(User user);

    @Delete("delete from user where id = #{id}")
    void deleteUserById(User user);

    void saveUser(User user);

    @Select("select id,username,phone,email from user where id = #{id}")
    User findUserUpById(User user);

    void userUpdateById(User user);
}
